package com.hdu.dwh.controller;


import com.hdu.dwh.dtos.SubjectDatabaseDto;
import com.hdu.dwh.service.ISubjectDatabaseService;
import com.hdu.dwh.results.ResponseResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 主题数据库表 前端控制器
 * </p>
 *
 * @author bobo
 * @since 2025-04-08
 */
@RestController
@RequestMapping("/subject/database")
@RequiredArgsConstructor
@Tag(name = "主题数据库")
@Deprecated
public class SubjectDatabaseController {

    private final ISubjectDatabaseService subjectDatabaseService;

    @Operation(summary ="新增主题数据库")
    @PostMapping("/add")
    public ResponseResult add(@Valid @RequestBody SubjectDatabaseDto subjectDatabaseDto) {
        return subjectDatabaseService.add(subjectDatabaseDto);
    }

    @Operation(summary ="查询详细信息")
    @GetMapping("/{id}")
    public ResponseResult getDetilById(@PathVariable Long id) {
        return subjectDatabaseService.getDetilById(id);
    }

    @Operation(summary ="删除数据库")
    @DeleteMapping ("/{id}")
    public ResponseResult delete(@PathVariable Long id) {
        return subjectDatabaseService.deleteById(id);
    }
}
